user = "test"
passwd = "testpwd"
count = 3

while count: # 这里while count>0, 可以直接写成 while count，更符合python的风格
    u = input("请输入用户名：\t")
    pwd = input("请输入密码：\t")
    if u != user or pwd != passwd:
        count -= 1
        print("Username or password is incorrect")
        print(f"You have {count} chances")
        continue
    elif u == user and pwd == passwd:
        print("Login Successful!")
        break
